package com.xsb.mvvmxsb.activity

import androidx.lifecycle.Observer
import com.xsb.mvvmlibrary.base.BaseVmActivity
import com.xsb.mvvmxsb.R
import com.xsb.mvvmxsb.databinding.ActivityMainBinding
import com.xsb.mvvmxsb.viewmodel.MainViewModel
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : BaseVmActivity<ActivityMainBinding, MainViewModel>() {
  override fun viewModelClass(): Class<MainViewModel> = MainViewModel::class.java

  override fun layoutRes(): Int {
   return R.layout.activity_main
  }

  override fun createObserver() {
    mViewModel.bannerData.observe(this, Observer {
      var stringU = StringBuilder()
      for (bannerResponse in it.data) {
        stringU.append(bannerResponse.desc)
      }
      tv_data.text = stringU.toString()
    })
  }

  override fun initView() {
    super.initView()
  }

  override fun initData() {
    super.initData()
  }

  override fun getBindingVariable(): Int {
    return 1
  }
}